<?php defined('ROOT_DIR') or die('Access denied!');?>
<!DOCTYPE HTML>
<html>
<head>
	<meta http-equiv="content-type" content="text/html" />
	<meta name="author" content="暮雨秋晨" />
	<meta charset="UTF-8" />
    <meta http-equiv="Cache-Control" content="no-cache" />
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1" />
    <meta name="description" content="<?php echo $config['desc'];?>" />
    <meta name="keywords" content="<?php echo $config['keywd'];?>" />
	<title><?php echo $title;?></title>
    <link rel="stylesheet" href="/Application/static/css/main.css" />
    <script src="/Application/static/js/common.js"></script>
</head>
<body>

<!-- header -->
<header>
<ul>
<li><a href="/" style="z-index: 50;">首页</a></li>
<li><a style="z-index: 49;cursor: pointer;"><?php echo $section['name'];?></a></li>
</ul>
</header>

<!-- body --> 
<div id="main">


<div id="subtitle">最新话题</div>
<div id="box">
<ul id="topic">
<?php echo viewTopic($section['id'],$start,10);?>
</ul>
<?php if($pages>1):?>
<!--引入分页模板-->
<?php if($nowpage!=1 && $pages>$nowpage):?>
<div id="pages">
<div style="border-top: 1px solid #eee;width: 97%;"><a href="<?php echo $next_url;?>">下一页</a>.<a href="<?php echo $last_url;?>">上一页</a><span style="margin-left: 1em;font-size: 12px;letter-spacing: 1px;">(<b><?php echo $nowpage;?></b>/<?php echo $pages;?>)</span></div>
</div>
<?php elseif($nowpage == $pages && $pages != 1):?>
<div id="pages">
<!--当前页面只有一页-->
<div style="border-top: 1px solid #eee;width: 97%;"><a href="<?php echo $last_url;?>">上一页</a><span style="margin-left: 1em;font-size: 12px;letter-spacing: 1px;">(<b><?php echo $nowpage;?></b>/<?php echo $pages;?>)</span></div>
</div>
<?php elseif($nowpage ==1 && $pages!=$nowpage):?>
<div id="pages">
<!--当前为第一页，总页数大于一-->
<div style="border-top: 1px solid #eee;width: 97%;"><a href="<?php echo $next_url;?>">下一页</a><span style="margin-left: 1em;font-size: 12px;letter-spacing: 1px;">(<b><?php echo $nowpage;?></b>/<?php echo $pages;?>)</span></div>
</div>
<?php endif;?>
<?php endif;?>
</div>
<hr style="margin: 0; padding: 0;display: block;width: 100%;" />
<div id="subtitle">发表话题</div>
<?php if($login_user):?>
<form action="<?php echo $this->urlCreate('increase','post',array('id'=>$section['id']));?>" method="post" style="display: block;width: 99%;">
<label id="title" style="margin: 1em;">标题</label>
<input type="text" name="title" id="title" maxlength="56" style="display: block;width: 97%;height: 24px;font-size: 1em;line-height: 24px;outline: none;margin: 0.5em auto;padding: 3px;" />
<label id="content" style="margin: 1em;">话题正文</label>
<textarea name="content" id="content" style="display: block;word-wrap: break-word;resize: vertical;outline: none;padding: 3px;min-height: 138px;width: 97%;margin: 0.5em auto;"></textarea>

<input type="submit" name="submit" value="发表" style="display: block;text-align: center; width: 60%;max-width: 128px;height: 24px;margin: 1em 20%;" />
</form>
<?php else:?>
<p style="color: #EE7700;text-align: center;">您未登录，无权发帖。请<a href="<?php echo $this->urlCreate('user','login');?>">登录</a>/<a href="<?php echo $this->urlCreate('user','register');?>">注册</a></p>
<?php endif;?>
</div>

<!-- footer -->
<footer>
&copy;<a href="http://www.doubear.com">Doubear</a> Driven by <a href="http://www.domvc.com">DoMVC</a> framework
</footer>
</body>
</html>